﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace Debugging.Form2
{
    public partial class Form2View : Form
    {
        public Form2View()
        {
            InitializeComponent();
            SetUpDataBinding();
        }
        void IView.Show()
        {
            this.ShowDialog();
        }
        void IView.NotifyUser(string message)
        {
            MessageBox.Show(message);
        }

        private void AcceptChangesButton_Click(object sender, EventArgs e)
        {
            OnAcceptChanges(new EventArgs());
        }
        
        private void SetUpDataBinding()
        {
            this.AcceptChangesButton.DataBindings.Add(new Binding("Enabled", this, "AcceptEnabled"));
            this.textFirstName.DataBindings.Add(new Binding("Text", this, "Customer.FirstName"));
            this.textLastName.DataBindings.Add(new Binding("Text", this, "Customer.LastName"));
        }
        
    }
}
